<?php ob_start() ?>

<div class="row">
    <?php if (isset($_SESSION['adminbetporra_msj'])) { ?>
        <div class="alert alert-success alert-dismissable col-lg-12 text-center">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            <strong><?php echo $_SESSION['adminbetporra_msj'] ?></strong>
        </div>
        <?php
        unset($_SESSION['adminbetporra_msj']);
    }
    ?>
    <div class="col-lg-12">
        <h1>Premios <small>Listado Premios</small></h1>
    </div>
</div>
<hr>
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <h3 class="panel-title"><i class="fa fa-suitcase"></i> Premios</h3>
            </div>
            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table table-bordered table-hover table-striped tablesorter" id="tabla_premios">
                        <thead>
                            <tr>
                                <th>Regalo <i class="fa fa-sort"></i></th>
                                <th>Usuario <i class="fa fa-sort"></i></th>
                                <th>Fecha <i class="fa fa-sort"></i></th>
                                <th>Estado <i class="fa fa-sort"></i></th>
                                <th>Acciones</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php foreach ($params_premios as $fila) { ?>
                                <tr
                                    <?php 
                                    if ($fila['estado'] == "Entregado"){
                                        echo "class='success'";
                                    } else if ($fila['estado'] == "Anulado"){
                                        echo "class='danger'";
                                    }
                                    ?>
                                    >
                                    <td><a href="ver_regalo/<?php echo $fila['regalo_id'] ?>" ><?php echo $fila['regalo_nombre'] ?></a></td>
                                    <td><a href="ver_usuario/<?php echo $fila['usuario_id'] ?>"><?php echo $fila['usuarios_usuario'] ?></a></td>
                                    <td><?php echo $fila['fecha'] ?></td>
                                    <td><?php echo $fila['estado'] ?></td>
                                    <td align="center"> <a href="modificar_premio/<?php echo $fila['id'] ?>"><i class="fa fa-edit" title="Modificar"></i></a></td>
                                </tr>
<?php } ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    
     <!-- Page-Level Scripts - Tables - Use for reference -->
        <script>
                $(document).ready(function() {
                    $('#tabla_premios').dataTable({
                        "order": [[2, "desc"]]
                    });
                });

        </script>
        
        
    <?php
    $contenido = ob_get_clean();
    include "app/templates/template_admin.php";
    ?>